]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
dateMenu: Make sure we always display a clock name
authorFlorian Müllner <fmuellner@gnome.org>
Fri, 12 Apr 2019 00:10:04 +0000 (02:10 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Fri, 12 Apr 2019 01:17:35 +0000 (03:17 +0200)
We currently use the city name for all location except named timezones.
However locations only have a city name if they are of level CITY or
DETACHED, or if they are of level WEATHER_STATION with a parent of level
CITY.

So when libgweather commit d7682676ac9 moved weather station locations from
cities to countries, it broke their names in the world clocks section.

To fix this, stop making assumptions about when we can use the city name
and simply try it first for all locations and fall back to the plain name
if its not available.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1150

js/ui/dateMenu.js

index 697d6fbc8dc8053d31aa25dd6eab1ca4e29636b9..f46ed2d3addb9701547e8f8b2f24c9ac1f511356 100644 (file)
@@ -139,8 +139,7 @@ var WorldClocksSection = class WorldClocksSection {
         for (let i = 0; i < this._locations.length; i++) {
             let l = this._locations[i].location;
 
-            let name = l.get_level() == GWeather.LocationLevel.NAMED_TIMEZONE ? l.get_name()
-                                                                              : l.get_city_name();
+            let name = l.get_city_name() || l.get_name();
             let label = new St.Label({ style_class: 'world-clocks-city',
                                        text: name,
                                        x_align: Clutter.ActorAlign.START,